package com.hunan.api.catv.action.member.related;

import com.hunan.api.catv.action.BaseAction;
import com.hunan.api.catv.annotation.MemberAuth;
import com.hunan.api.catv.common.Api;
import com.hunan.api.catv.entity.Result;
import com.hunan.api.catv.entity.po.MemberAccountRelated;
import com.hunan.api.catv.service.biz.member.related.MemberAccountRelatedBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: wangchao
 * @Date: 2021/4/8 9:13
 */
@RestController
@RequestMapping(Api.related)
@Validated
public class MemberAccountRelatedAction extends BaseAction {

    @Autowired
    MemberAccountRelatedBiz memberAccountRelatedBiz;

    /**
     * 大小屏账号绑定
     */
    @MemberAuth
    @PostMapping("/saveMemberAccountBind")
    public Result saveMemberAccountBind(@RequestBody MemberAccountRelated memberAccountRelated, HttpServletRequest request) {
        String version = request.getHeader("v");
        return buildResultCode(memberAccountRelatedBiz.saveMemberAccountBind(memberAccountRelated, getMemberIdV2(request),version));
    }
}
